﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EasyComm.Client
{
    public partial class EasyCommClientForm : Form
    {
        public EasyCommClientForm()
        {
            InitializeComponent();
        }
        public EasyCommClientForm(string loggeduser)
        {
            InitializeComponent();
            this.LoggedUser = loggeduser;
        }
        bool bCloseNotFromMainForm;
        public string LoggedUser= "";
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bCloseNotFromMainForm = true;
            this.Close();
        }

        private void exitContextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bCloseNotFromMainForm = true;
            this.Close();
        }

        private void showContextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Visible = true;
        }

        private void EasyCommClientForm_FormClosing(object sender, FormClosingEventArgs e)
        {
          if (!bCloseNotFromMainForm)
          {
              e.Cancel = true;
              this.Visible = false;
              SMessengerNotifyIcon.ShowBalloonTip(1000);
          }
            
        }

        private void SMessengerNotifyIcon_DoubleClick(object sender, EventArgs e)
        {
            this.Visible = true;
        }

        private void EasyCommClientForm_Load(object sender, EventArgs e)
        {
            stUserName.Text = LoggedUser;
            comboBoxStatusMainForm.SelectedIndex = 0;
            listViewMainForm.Items.Add("user1");
            listViewMainForm.Items.Add("Harish");
        }

        private void listViewMainForm_DoubleClick(object sender, EventArgs e)
        {
            ChatWindowForm cwf = new ChatWindowForm();
            cwf.Text = this.listViewMainForm.SelectedItems[0].Text;
            cwf.Show();
        }

        private void comboBoxStatusMainForm_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxStatusMainForm.SelectedIndex == 0)
            {
                //pictureBoxStatus.Image = global::EasyComm.Client.Resource.Green;
            }
            else if (comboBoxStatusMainForm.SelectedIndex == 1)
            {
                //pictureBoxStatus.Image = global::EasyComm.Client.Resource.Red;
            }
            else
            {
                //pictureBoxStatus.Image = global::EasyComm.Client.Resource.Orange;
            }
        }
    }
}
